#import <Foundation/Foundation.h>
#import "SynthesizeSingleton.h"
#import "sqlite3.h"
#import "JokeModel.h"
#import "TopicModel.h"
#import "FMDatabase.h"
#import "FMDatabaseQueue.h"

@interface DBManager : NSObject {
    NSString *dbName;
    FMDatabaseQueue *dbQueue;
}

SYNTHESIZE_SINGLETON_FOR_CLASS_HEADER(DBManager);

-(BOOL)createJokeTable:(NSString*)sort;
-(void)saveJoke:(NSString *)sort :(JokeModel *)joke;
-(BOOL)getJokeImgFull:(NSString *)sort :(JokeModel *)pJoke;
-(BOOL)getJokeImgThumb:(NSString *)sort :(JokeModel *)pJoke;
-(BOOL)getJokeImgGif:(NSString *)sort :(JokeModel *)pJoke;
-(BOOL)getJokeImgAll:(NSString *)sort :(JokeModel *)pJoke;
-(NSMutableArray *)getAllJokeSummary:(NSString *)sort;
-(void)updateJoke:(NSString *)sort :(JokeModel *)pJoke;
-(void)deleteJokes:(NSString *)sort :(NSMutableArray *)ids;
-(void)removeJokeLikeState:(NSString *)sort;

////获取topic相关
-(BOOL)createTopicTable:(NSString*)sort; //创建主题表
-(BOOL)saveTopic:(NSString *)sort :(TopicModel *)topic;  //保存主题
-(NSMutableArray *)getAllTopicSummary:(NSString *)sort;
-(BOOL)getTopicImg:(NSString *)sort :(TopicModel *)pTopic;
-(void)deleteTopics:(NSString *)sort :(NSMutableArray *)ids;
-(void)clearAllData;

@end
